package cpr;

import robocode.control.events.BattleCompletedEvent;
import robocode.control.events.TurnEndedEvent;
import robocode.control.snapshot.IRobotSnapshot;
import robocode.control.testing.RobotTestBed;
import static org.junit.Assert.assertTrue;
/**
 * 
 * @author Christopher Ramelb
 * Will check to see if my robot fires. 
 *
 */
public class TestFire extends RobotTestBed {
  Boolean fired = false;
  /**
   * 
   * @author Christopher Ramelb
   * This is tests to see if BobBot is firing.
   * Please credit Philip Johnson and his pmj.DaCruzer Robot
   * for help and providing a template o the following code.  
   *
   */
  
    /**
     * Specifies that SittingDuck and BobBot will be used in this match.
     * @return the list of robots used in the match
     */
    @Override
    public String getRobotNames() {
      return "sample.Crazy,cpr.BobBot";
    }
    /**
     * Override default number of rounds from 1 to 10.
     * @return the number of rounds
     */
    @Override
    public int getNumRounds() {
      return 10;
    }
  /**
   * After each turn, check to see if we're at a corner.  If so, set the corresponding flag.
   * @param event Info about the current state of the battle.
   */
  @Override 
  public void onTurnEnded(TurnEndedEvent event) {
    IRobotSnapshot robot = event.getTurnSnapshot().getRobots()[1];
    if (robot.getGunHeat() > 1) {
      fired = true;
    }
  } 
  /**
   * After the battle, check to see that BobBot fired. 
   * @param event Details about the completed battle.
   */
  @Override
  public void onBattleCompleted(BattleCompletedEvent event) {
    assertTrue("Fired this battle", fired);
    
  }
}